﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace linkouqs.Gamekit {

    public class CharacterStateTakeRun : CharacterState {

        CharacterAbilityThrow m_Throw;

        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
            base.OnStateEnter(animator, stateInfo, layerIndex);
            m_Throw = animator.GetComponent<CharacterAbilityThrow>();
        }

        public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
            if (!Character.IsPressedAction()) {
                return;
            }

            if (m_Throw.CanStartAction()) {
                m_Throw.StartAction();
                return;
            }
        }

        public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
            m_Throw = null;
            base.OnStateExit(animator, stateInfo, layerIndex);
        }

    }

}